<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<input TYPE="submit" value="post请求" onclick="clickpost()"><br/>
<input TYPE="submit" value="GET请求" onclick="clickGet()"><br/>
<script type="text/javascript">
    function clickpost(){
        var param={"username":"tom","password":"888","nickname":"admin"}
        $.ajax({
            type:"POST",
            data:JSON.stringify(param),
            url:"/user/tp",
            contentType:"application/json",
            success:function (data){
                alert(data);
            },
            error:function (data){
                console.log(data);
            }
        })
    }
    function clickGet(){
        $.ajax({
            type:"GET",
            url:"/user/tg",
            contentType:"appaction/json",
            success:function (data){
               console.log(data);
            },
            error:function (data){
                console.log(data);
            }
        })
    }
</script>
</body>
</html>